#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main()
{
	int n = 0;
	int m = 0;
	scanf("%d %d", &n, &m);
	int i = 0;
	int j = 0;
	int arr[10][10] = { 0 };
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}

	int sum = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			if (arr[i][j] > 0)
			{
				sum += arr[i][j];
			}
		}
	}

	printf("%d", sum);
	return 0;
}

#include<math.h>
#include<stdlib.h>

int main()
{
	int n = 0;
	scanf("%d", &n);
	int i = 0;
	while (pow(6, i) <= n)
	{
		i++;
	}
	i--;
	while (i > -1)
	{
		int m = n / pow(6, i);
		
		printf("%d", m);
		n -= (m * pow(6, i));
		
		i--;
	}
	return 0;
}




int main()
{
	int arr[10][10] = { 0 };
	int n = 0;
	int m = 0;
	scanf("%d %d", &n, &m);
	int i = 0;
	int j = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}

	for (j = 0; j < m; j++)
	{
		for (i = 0; i < n; i++)
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n = 0;
	scanf("%d", &n);
	int arr[50] = { 0 };
	int i = 0;
	int j = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	int delete = 0;
	scanf("%d", &delete);
	int tmp[50] = { 0 };
	for (i = 0; i < n; i++)
	{
		if (arr[i] != delete)
		{
			tmp[j] = arr[i];
			j++;
		}
	}
	int k = 0;
	for (i = 0; i < j; i++)
	{
		printf("%d ", tmp[i]);
	}
	return 0;
}

void Print(int n)
{

	if (n > 5)
	{
		Print(n / 6);
	}
	printf("%d", n % 6);

}


int main()
{
	int n = 0;
	scanf("%d", &n);
	Print(n);
	return 0;
}